﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using PlayDeezGames.Common;
using System.Xml.Linq;

namespace DungeonDelver.Engine
{
    public abstract class DescriptoredEntityBase : EntityBase
    {
        private Descriptor descriptor = null;

        public Descriptor Descriptor
        {
            get
            {
                return descriptor;
            }
        }
        protected DescriptoredEntityBase(IEntity parent)
            : base(parent)
        {
            descriptor = new Descriptor(this);
        }

        protected DescriptoredEntityBase(IEntity parent, XElement theXElement)
            : base(parent, theXElement)
        {
        }

        protected override void OnFromXElement(System.Xml.Linq.XElement theXElement)
        {
            foreach (var child in Children)
            {
                if (child.GetType()==typeof(Descriptor))
                {
                    descriptor = child as Descriptor;
                }
            }
        }
    }
}
